import {request} from '../../utils/http'

Page({
  data: {
    stage_id:null,
    list:[]
  },
  onLoad(query:any) {
    this.setData({
      stage_id:query.stage_id
    }, () => {
      this.getList()

    })
  },
  getList(){
    request('/my_coupons','get',{stage_id:this.data.stage_id,status:0}).then(res => {
      if (res.code == 200) {
        this.setData({
          list:res.data
        })
      }
    })
  },
  handleClick(e){
    let { item } = e

    console.log(item)
    var pages = getCurrentPages();
   
    var prevPage = pages[pages.length - 2]; //上一个页面

    console.log(prevPage)

    prevPage.setData({
      use_coupon:{
        coupon_received_id: item.coupon_received_id,
        title:item.title
      }
    })

    my.navigateBack()
  }
});
